package simpleSolutions.vale.data.util;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class OpenHelper extends SQLiteOpenHelper {

	public OpenHelper(Context context) {
		super(context, "OqueFazerComMeuVale", null, 1);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		ConfigTable configTable = new ConfigTable();
		HistoricoTable historicoTable = new HistoricoTable();
		try {
			configTable.onCreate(db);
			historicoTable.onCreate(db);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

		db.execSQL("DROP TABLE IF EXISTS Reabastecimento");
		onCreate(db);
	}
}